import desmontec.sistema.*


class BootStrap {
	// lenin.medeiros - INICIO
	def  springSecurityService
	// lenin.medeiros - FIM
	

    def init = { 
		// lenin.medeiros - INICIO
		/* servletContext -> */
		def userRole = SecRole.findByAuthority('ROLE_USER') ?: new SecRole(authority: 'ROLE_USER').save(failOnError: true)
		def adminRole = SecRole.findByAuthority('ROLE_ADMIN') ?: new SecRole(authority: 'ROLE_ADMIN').save(failOnError: true)
		
		def adminUser = SecUser.findByUsername('admin') ?: new SecUser(
			username: 'admin',
			password: springSecurityService.encodePassword('12345678'),
			enabled: true).save(failOnError: true)
			
		def usuario1 = SecUser.findByUsername('usuario1') ?: new SecUser(
			username: 'usuario1',
			password: springSecurityService.encodePassword('12345678'),
			enabled: true).save(failOnError: true)				
		// lenin.medeiros - FIM
    }
    def destroy = {
    }
}
